package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zbaq {
   private zn a;
   private com.aspose.cells.b.a.b.zq b;
   private zbai c;
   private com.aspose.cells.b.a.b.zg d;
   private float e;
   private float f;
   private float g;
   private ArrayList h;
   private boolean i;
   private boolean j;

   public zbaq(com.aspose.cells.b.a.b.zq var1, zbai var2, zahq var3, com.aspose.cells.b.a.b.zg var4) {
      this(var1, var2, var3, var4, 1.0F, 1.0F);
   }

   public zbaq(com.aspose.cells.b.a.b.zq var1, zbai var2, zahq var3, com.aspose.cells.b.a.b.zg var4, float var5, float var6) {
      this.i = false;
      this.j = false;
      this.b = var1;
      this.c = var2;
      this.h = new ArrayList();

      for(int var7 = 0; var7 < var3.getCount(); ++var7) {
         com.aspose.cells.b.a.a.ze.a(this.h, (Object)var3.a(var7));
      }

      this.d = var4;
      this.f = var5;
      this.g = var6;
   }

   public com.aspose.cells.b.a.b.zq a(zn var1) {
      this.a = var1;
      if (!this.a()) {
         return com.aspose.cells.b.a.b.zq.c();
      } else {
         this.e = this.a.a("A", this.d).c() * this.g;
         if (this.h != null && this.h.size() > 0) {
            com.aspose.cells.b.a.b.zv var2 = new com.aspose.cells.b.a.b.zv();
            var2.a(this.c.a());
            var2.c(this.c.b());
            this.a(this.h);
            if (this.c.b() == 0) {
               if (this.c.a() == 0) {
                  this.b(this.h);
                  this.c(this.h);
               } else if (this.c.a() == 1) {
                  this.b(this.h);
                  this.a(this.h, true);
                  this.c(this.h);
               } else {
                  this.b(this.h);
                  this.a(this.h, false);
                  this.c(this.h);
               }
            } else if (this.c.b() == 2) {
               if (this.c.a() == 0) {
                  this.b(this.h);
                  this.b(this.h, false);
                  this.c(this.h);
               } else if (this.c.a() == 1) {
                  this.b(this.h);
                  this.a(this.h, true);
                  this.b(this.h, false);
                  this.c(this.h);
               } else {
                  this.b(this.h);
                  this.a(this.h, false);
                  this.b(this.h, false);
                  this.c(this.h);
               }
            } else if (this.c.a() == 0) {
               this.b(this.h);
               this.b(this.h, true);
               this.c(this.h);
            } else if (this.c.a() == 1) {
               this.b(this.h);
               this.a(this.h, true);
               this.b(this.h, true);
               this.c(this.h);
            } else {
               this.b(this.h);
               this.a(this.h, false);
               this.b(this.h, true);
               this.c(this.h);
            }

            float var3 = 0.0F;
            float var4 = 0.0F;
            float var5 = 0.0F;
            float var6 = 0.0F;
            boolean var7 = true;

            int var8;
            for(var8 = 0; var8 < this.h.size(); ++var8) {
               zbal var9 = (zbal)this.h.get(var8);
               if (var9.e() == 2 || var9.e() == 1) {
                  if (var7) {
                     var3 = var9.a.j();
                     var4 = var9.a.k();
                     var6 = var9.a.l();
                     var5 = var9.a.m();
                     var7 = false;
                  } else {
                     if (var9.a.j() < var3) {
                        var3 = var9.a.j();
                     }

                     if (var9.a.k() < var4) {
                        var4 = var9.a.k();
                     }

                     if (var9.a.l() > var6) {
                        var6 = var9.a.l();
                     }

                     if (var9.a.m() > var5) {
                        var5 = var9.a.m();
                     }
                  }
               }
            }

            this.i = true;
            var8 = zbuk.a((double)(var6 - var3));
            int var10 = zbuk.a((double)(var5 - var4));
            return new com.aspose.cells.b.a.b.zq(var3, var4, (float)var8, (float)var10);
         } else {
            return com.aspose.cells.b.a.b.zq.c();
         }
      }
   }

   public void b(zn var1) {
      Iterator var2 = this.h.iterator();

      zbal var3;
      while(var2.hasNext()) {
         var3 = (zbal)var2.next();
         var3.a.a(0.0F);
         var3.a.b(0.0F);
      }

      if (!this.i) {
         this.j = true;
         this.a(var1);
      } else {
         this.a = var1;
      }

      var2 = this.h.iterator();

      while(true) {
         while(true) {
            do {
               if (!var2.hasNext()) {
                  return;
               }

               var3 = (zbal)var2.next();
            } while(var3.e() != 2);

            com.aspose.cells.b.a.b.zg var4 = var3.b();
            float var5 = this.a(var4);
            float var6 = var5 * (float)var4.b().c(var4.k()) / (float)var4.b().e(var4.k());
            float var7 = var5 * (float)var4.b().d(var4.k()) / (float)var4.b().e(var4.k());
            float var8 = var5 * (float)var4.b().f(var4.k()) / (float)var4.b().e(var4.k());
            float var9 = var8 - var6 - var7;
            float var10 = var3.a.g() - (var8 - var5) / 2.0F + var6;
            var3.a.a(var3.a.f() - var9);
            com.aspose.cells.b.a.b.zv var11 = new com.aspose.cells.b.a.b.zv(com.aspose.cells.b.a.b.zv.c());
            zxp var12 = var3.d();
            if (var12.i()) {
               this.a.a(var3.a(), var3.b(), new com.aspose.cells.b.a.b.zu(var3.c()), (com.aspose.cells.b.a.b.zo)var3.a.d(), var11);
            } else {
               String var13 = var3.a();
               if (var12.f() || var12.g()) {
                  var13 = var13.toUpperCase();
               }

               float var14 = var3.b().h();
               if (var12.h()) {
                  var14 *= 1.5F;
               } else if (var12.d() || var12.c()) {
                  var14 *= 0.7F;
               }

               com.aspose.cells.b.a.b.zg var15 = new com.aspose.cells.b.a.b.zg(var3.b().b(), var14, var3.b().k());
               float var16 = this.a(var15);
               float var17 = var16 * (float)var15.b().d(var15.k()) / (float)var15.b().e(var15.k());
               float var18 = var16 * (float)var15.b().c(var15.k()) / (float)var15.b().e(var15.k());
               float var19 = var16 * (float)var15.b().f(var15.k()) / (float)var15.b().e(var15.k());
               float var20 = var19 - var18 - var17;
               com.aspose.cells.b.a.b.zo var21 = new com.aspose.cells.b.a.b.zo(var3.a.d().d(), var3.a.d().e());
               float var22 = var10 - var18;
               var21.b(var22 - (float)(var12.e() / 100.0D * (double)var5));
               this.a.a(var13, var15, new com.aspose.cells.b.a.b.zu(var3.c()), (com.aspose.cells.b.a.b.zo)var21, var11);
            }
         }
      }
   }

   private boolean a() {
      return this.b.h() > 0.0F && this.b.i() > 0.0F;
   }

   private void a(ArrayList var1) {
      com.aspose.cells.b.a.g.a.ze var2 = new com.aspose.cells.b.a.g.a.ze("\\n");

      zbal var7;
      for(int var3 = 0; var3 < var1.size(); ++var3) {
         zbal var4 = (zbal)var1.get(var3);
         String[] var5 = var2.c(var4.a());
         if (var5.length > 1) {
            for(int var6 = 0; var6 < var5.length; ++var6) {
               if (!"".equals(var5[var6])) {
                  var7 = new zbal(var5[var6], var4.b(), var4.c(), var4.d(), 2);
                  var1.add(var3, var7);
                  ++var3;
               } else if ("".equals(var5[var6]) && var6 == var5.length - 1) {
                  break;
               }

               if (var6 != var5.length - 1) {
                  var7 = new zbal("", var4.b(), var4.c(), var4.d(), 0);
                  var1.add(var3, var7);
                  ++var3;
               }
            }

            var1.remove(var3);
            --var3;
         }
      }

      com.aspose.cells.b.a.g.a.ze var12 = new com.aspose.cells.b.a.g.a.ze("(\\s){1,}");

      for(int var11 = 0; var11 < var1.size(); ++var11) {
         zbal var13 = (zbal)var1.get(var11);
         com.aspose.cells.b.a.g.a.zd var15 = var12.b(var13.a());
         if (var15.a() > 0) {
            int var8 = 0;

            for(int var9 = 0; var9 < var15.a(); ++var9) {
               String var10;
               if (var15.a(var9).d() > var8) {
                  var10 = var13.a().substring(var8, var8 + (var15.a(var9).d() - var8));
                  var7 = new zbal(var10, var13.b(), var13.c(), var13.d(), 2);
                  var1.add(var11, var7);
                  ++var11;
               }

               var7 = new zbal(var15.a(var9).a(), var13.b(), var13.c(), var13.d(), 1);
               var1.add(var11, var7);
               ++var11;
               var8 = var15.a(var9).d() + var15.a(var9).a().length();
               if (var9 == var15.a() - 1 && var8 <= var13.a().length() - 1) {
                  var10 = var13.a().substring(var8, var8 + (var13.a().length() - var8));
                  var7 = new zbal(var10, var13.b(), var13.c(), var13.d(), 2);
                  var1.add(var11, var7);
                  ++var11;
               }
            }

            var1.remove(var11);
            --var11;
         }
      }

      com.aspose.cells.b.a.b.zv var16 = new com.aspose.cells.b.a.b.zv();
      var16.b(2048);

      for(int var14 = 0; var14 < var1.size(); ++var14) {
         zbal var17 = (zbal)var1.get(var14);
         com.aspose.cells.b.a.b.zt var18;
         if (var17.e() != 0) {
            var18 = this.a(var17.a(), var17.b());
            var18.a(var18.b() * this.f);
            var18.b(var18.c() * this.g);
            var17.c = var18;
         } else {
            var18 = this.a("A", var17.b());
            var18.a(var18.b() * this.f);
            var18.b(var18.c() * this.g);
            var17.c = var18;
         }
      }

   }

   private String[] a(String var1, float var2, com.aspose.cells.b.a.b.zg var3) {
      if (var1 != null && var1.length() >= 1) {
         String[] var4 = new String[2];
         if (var1.length() == 1) {
            return new String[]{var1, ""};
         } else {
            for(int var5 = 1; var5 <= var1.length(); ++var5) {
               String var6 = var1.substring(0, 0 + var5);
               com.aspose.cells.b.a.b.zt var7 = this.a(var6, var3);
               if (var7.b() > var2) {
                  var4[0] = var1.substring(0, 0 + (var5 - 1));
                  var4[1] = var1.substring(var5 - 2 > 0 ? var5 - 2 : var5 - 1);
                  break;
               }
            }

            return var4;
         }
      } else {
         return new String[]{"", ""};
      }
   }

   private com.aspose.cells.b.a.b.zt a(String var1, com.aspose.cells.b.a.b.zg var2) {
      com.aspose.cells.b.a.b.zt var3 = zbuk.a(this.a, var1, var2, new com.aspose.cells.b.a.b.zt(2.14748365E9F, 2.14748365E9F));
      return var3;
   }

   private void b(ArrayList var1) {
      com.aspose.cells.b.a.b.zo var2 = this.b.d();
      float var3 = -3.4028235E38F;

      for(int var4 = 0; var4 < var1.size(); ++var4) {
         zbal var5 = (zbal)var1.get(var4);
         float var6 = this.b.l() - var2.d();
         zbal var7;
         if (var5.e() == 0) {
            var5.a = new com.aspose.cells.b.a.b.zq(this.b.f(), var2.e(), this.b.h(), var5.c.c());
            var2.a(this.b.d().d());
            var7 = null;
            if (var4 > 0) {
               var7 = (zbal)var1.get(var4 - 1);
            }

            if (var6 != this.b.l() - this.b.j() && var7 != null && var7.e() == 1) {
               boolean var15 = false;

               for(int var16 = var4 - 1; var4 > 0; --var16) {
                  var7 = (zbal)var1.get(var16);
                  if (var7.e() == 2) {
                     var15 = true;
                     break;
                  }

                  if (var7.a.f() == this.b.f()) {
                     break;
                  }
               }

               if (var15) {
                  var2.b(var2.e() + (var3 == -3.4028235E38F ? var5.c.c() : var3));
               }
            } else {
               var2.b(var2.e() + (var3 == -3.4028235E38F ? var5.c.c() : var3));
            }

            var3 = -3.4028235E38F;
         } else if (var5.e() == 1) {
            if (var5.c.b() < var6) {
               var5.a.a(var2);
               var5.a.a(var5.c);
               var2.a(var2.d() + var5.c.b());
            } else if (var6 != 0.0F) {
               var5.c.a(var6);
               var5.a.a(var2);
               var5.a.a(var5.c);
               var2.a(this.b.f());
               var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
               var3 = -3.4028235E38F;
            } else {
               var5.c.a(var6);
               var5.a.a(var2);
               var5.a.a(var5.c);
               var2.a(this.b.f());
               var3 = -3.4028235E38F;
            }
         } else if (var5.e() == 2) {
            var7 = null;
            zbal var8 = null;
            if (var4 > 0) {
               var7 = (zbal)var1.get(var4 - 1);
            }

            if (var4 + 1 < var1.size()) {
               var8 = (zbal)var1.get(var4 + 1);
            }

            String[] var9;
            zbal var10;
            if (var7 != null && var7.e() == 1) {
               if (var5.c.b() > var6) {
                  var2.a(this.b.f());
                  var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
                  var3 = var5.c.c();
                  var6 = this.b.l() - var2.d();
                  if (var5.c.b() < var6) {
                     var5.a.a(var2);
                     var5.a.a(var5.c);
                     var2.a(var2.d() + var5.c.b());
                  } else if (var5.c.b() == var6) {
                     var5.a.a(var2);
                     var5.a.a(var5.c);
                     var2.a(this.b.f());
                     var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
                     var3 = -3.4028235E38F;
                  } else {
                     var9 = this.a(var5.a(), var6, var5.b());
                     var10 = new zbal(var9[0], var5.b(), var5.c(), var5.d(), 2);
                     var10.a = new com.aspose.cells.b.a.b.zq(var2, new com.aspose.cells.b.a.b.zt(var6, var5.c.c()));
                     var10.c = var10.a.e();
                     var1.add(var4, var10);
                     var5.a(var9[1]);
                     var5.c = this.a(var5.a(), var5.b());
                     if (var3 < var5.c.c()) {
                        var3 = var5.c.c();
                     }

                     var2.a(this.b.f());
                     var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
                     var3 = -3.4028235E38F;
                  }
               } else {
                  float var13 = var5.c.b();

                  int var14;
                  for(var14 = var4 + 1; var14 < var1.size() && var8.e() == 2; ++var14) {
                     var8 = (zbal)var1.get(var14);
                     if (var8.e() != 2) {
                        break;
                     }

                     var13 += var8.c.b();
                     if (var13 > var6) {
                        break;
                     }
                  }

                  if (var13 < var6) {
                     while(var4 < var14) {
                        var8 = (zbal)var1.get(var4);
                        var8.a.a(var2);
                        var8.a.a(var8.c);
                        if (var3 < var8.c.c()) {
                           var3 = var8.c.c();
                        }

                        var2.a(var2.d() + var8.c.b());
                        ++var4;
                     }

                     --var4;
                  } else if (var13 != var6) {
                     if (var2.d() == this.b.f()) {
                        while(var4 < var14) {
                           var8 = (zbal)var1.get(var4);
                           var6 -= var8.c.b();
                           if (var6 < 0.0F) {
                              if (var2.d() != this.b.f()) {
                                 var2.a(this.b.f());
                                 var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
                                 var3 = -3.4028235E38F;
                                 break;
                              }

                              String[] var11 = this.a(var8.a(), this.b.h(), var8.b());
                              zbal var12 = new zbal(var11[0], var8.b(), var8.c(), var5.d(), 2);
                              var12.a = new com.aspose.cells.b.a.b.zq(var2, new com.aspose.cells.b.a.b.zt(var6, var8.c.c()));
                              var12.c = var12.a.e();
                              var1.add(var4, var12);
                              var8.a(var11[1]);
                              var8.c = this.a(var8.a(), var8.b());
                              if (var3 < var8.c.c()) {
                                 var3 = var8.c.c();
                              }

                              var2.a(this.b.f());
                              var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
                              var3 = -3.4028235E38F;
                           }

                           var8.a.a(var2);
                           var8.a.a(var8.c);
                           if (var3 < var8.c.c()) {
                              var3 = var8.c.c();
                           }

                           var2.a(var2.d() + var8.c.b());
                           ++var4;
                        }
                     } else {
                        var2.a(this.b.f());
                        var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
                        var3 = -3.4028235E38F;
                        --var4;
                     }
                  } else {
                     while(var4 < var14) {
                        var8 = (zbal)var1.get(var4);
                        var8.a.a(var2);
                        var8.a.a(var8.c);
                        if (var3 < var8.c.c()) {
                           var3 = var8.c.c();
                        }

                        var2.a(var2.d() + var8.c.b());
                        ++var4;
                     }

                     --var4;
                     var2.b(var2.e() + var8.c.c());
                     var3 = -3.4028235E38F;
                  }
               }
            } else if (var5.c.b() < var6) {
               var5.a.a(var2);
               var5.a.a(var5.c);
               if (var3 < var5.c.c()) {
                  var3 = var5.c.c();
               }

               var2.a(var2.d() + var5.c.b());
            } else if (var5.c.b() == var6) {
               var5.a.a(var2);
               var5.a.a(var5.c);
               if (var3 < var5.c.c()) {
                  var3 = var5.c.c();
               }

               var2.a(var2.d() + var5.c.b());
               var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
               var3 = -3.4028235E38F;
            } else {
               var9 = this.a(var5.a(), var6, var5.b());
               var10 = new zbal(var9[0], var5.b(), var5.c(), var5.d(), 2);
               var10.a = new com.aspose.cells.b.a.b.zq(var2, new com.aspose.cells.b.a.b.zt(var6, var5.c.c()));
               var10.c = var10.a.e();
               var1.add(var4, var10);
               var5.a(var9[1]);
               var5.c = this.a(var5.a(), var5.b());
               if (var3 < var5.c.c()) {
                  var3 = var5.c.c();
               }

               var2.a(this.b.f());
               var2.b(var2.e() + (var3 == -3.4028235E38F ? this.e : var3));
               var3 = -3.4028235E38F;
            }
         }
      }

      if (this.j) {
         this.d(var1);
      }

   }

   private void a(ArrayList var1, boolean var2) {
      int var3 = 0;
      float var4 = Float.MAX_VALUE;
      float var5 = 0.0F;

      int var6;
      zbal var7;
      for(var6 = 0; var6 < var1.size(); ++var6) {
         var7 = (zbal)var1.get(var6);
         if (var7.e() != 0) {
            if (var7.a.g() > var4) {
               for(int var8 = var6 - 1; var8 > var3; --var8) {
                  zbal var9 = (zbal)var1.get(var8);
                  if (var9.e() == 2) {
                     break;
                  }

                  if (var9.e() == 1) {
                     var5 -= var9.c.b();
                  }
               }

               float var13 = 0.0F;
               if (var2) {
                  var13 = (this.b.h() - var5) / 2.0F;
               } else {
                  var13 = this.b.h() - var5;
               }

               for(int var14 = var3; var14 < var6; ++var14) {
                  zbal var10 = (zbal)var1.get(var14);
                  if (var10.e() == 2) {
                     var10.a.a(var10.a.f() + var13);
                  }
               }

               var5 = 0.0F;
               var3 = var6;
            }

            var5 += var7.c.b();
            var4 = var7.a.g();
         }
      }

      for(var6 = var1.size() - 1; var6 > var3; --var6) {
         var7 = (zbal)var1.get(var6);
         if (var7.e() == 2) {
            break;
         }

         if (var7.e() == 1) {
            var5 -= var7.c.b();
         }
      }

      float var11 = 0.0F;
      if (var2) {
         var11 = (this.b.h() - var5) / 2.0F;
      } else {
         var11 = this.b.h() - var5;
      }

      for(int var12 = var3; var12 < var1.size(); ++var12) {
         zbal var15 = (zbal)var1.get(var12);
         if (var15.e() == 2) {
            var15.a.a(var15.a.f() + var11);
         }

         if (var15.e() == 1) {
            var15.a.a(var15.a.f() + var11);
         }

         if (var15.e() == 0) {
            var15.a.a(var15.a.f() + var11);
         }
      }

   }

   private void c(ArrayList var1) {
      int var2 = 0;
      float var3 = Float.MAX_VALUE;
      float var4 = -3.4028235E38F;
      float var5 = Float.MAX_VALUE;
      zbal var6 = null;

      float var10;
      float var11;
      float var12;
      float var17;
      float var18;
      float var19;
      float var20;
      for(int var7 = 0; var7 < var1.size(); ++var7) {
         zbal var8 = (zbal)var1.get(var7);
         if (var8.e() == 2) {
            if (var8.a.g() > var5) {
               if (var3 != var4) {
                  com.aspose.cells.b.a.b.zg var9 = var6.b();
                  var10 = this.a(var9) * (float)var9.b().c(var9.k()) / (float)var9.b().e(var9.k());
                  var11 = this.a(var9) * (float)var9.b().d(var9.k()) / (float)var9.b().e(var9.k());
                  var12 = this.a(var9) * (float)var9.b().f(var9.k()) / (float)var9.b().e(var9.k());
                  float var13 = var12 - var10 - var11;

                  for(int var14 = var2; var14 < var7; ++var14) {
                     zbal var15 = (zbal)var1.get(var14);
                     if (var15.e() == 2 && var15 != var6) {
                        com.aspose.cells.b.a.b.zg var16 = var15.b();
                        var17 = this.a(var16);
                        var18 = var17 * (float)var16.b().d(var16.k()) / (float)var16.b().e(var16.k());
                        var19 = var17 * (float)var16.b().c(var16.k()) / (float)var16.b().e(var16.k());
                        var20 = var17 * (float)var16.b().f(var16.k()) / (float)var16.b().e(var16.k());
                        float var21 = var20 - var19 - var18;
                        var15.a.b(var15.a.g() + (var10 - var19 - var13) * this.g);
                     }
                  }
               }

               var2 = var7;
               var3 = Float.MAX_VALUE;
               var4 = -3.4028235E38F;
            }

            var5 = var8.a.g();
            if (var8.c.c() < var3) {
               var3 = var8.c.c();
            }

            if (var8.c.c() > var4) {
               var4 = var8.c.c();
               var6 = var8;
            }
         }
      }

      if (var3 != var4 && var3 != Float.MAX_VALUE && var4 != -3.4028235E38F && var6 != null) {
         com.aspose.cells.b.a.b.zg var22 = var6.b();
         float var23 = this.a(var22);
         float var24 = var23 * (float)var22.b().c(var22.k()) / (float)var22.b().e(var22.k());
         var10 = var23 * (float)var22.b().d(var22.k()) / (float)var22.b().e(var22.k());
         var11 = var23 * (float)var22.b().f(var22.k()) / (float)var22.b().e(var22.k());
         var12 = var11 - var24 - var10;

         for(int var25 = var2; var25 < var1.size(); ++var25) {
            zbal var26 = (zbal)var1.get(var25);
            if (var26.e() == 2 && var26 != var6) {
               com.aspose.cells.b.a.b.zg var27 = var26.b();
               float var28 = this.a(var27);
               var17 = var28 * (float)var27.b().d(var27.k()) / (float)var27.b().e(var27.k());
               var18 = var28 * (float)var27.b().c(var27.k()) / (float)var27.b().e(var27.k());
               var19 = var28 * (float)var27.b().f(var27.k()) / (float)var27.b().e(var27.k());
               var20 = var19 - var18 - var17;
               var26.a.b(var26.a.g() + (var24 - var18 - var12) * this.g);
            }
         }
      }

   }

   private void b(ArrayList var1, boolean var2) {
      float var3 = -3.4028235E38F;
      float var4 = -3.4028235E38F;
      float var5 = 0.0F;

      zbal var7;
      for(int var6 = var1.size() - 1; var6 >= 0; --var6) {
         var7 = (zbal)var1.get(var6);
         if (var7.e() == 0) {
            if (var6 < var1.size() - 1) {
               if (((zbal)var1.get(var6 + 1)).e() == 2) {
                  var5 += var3;
               } else {
                  var5 += this.e;
               }
            }

            var3 = -3.4028235E38F;
            var4 = -3.4028235E38F;
         } else if (var7.e() == 2) {
            if (var7.a.g() < var4) {
               var5 += var3;
               var3 = -3.4028235E38F;
            }

            var4 = var7.a.g();
            if (var7.c.c() > var3) {
               var3 = var7.c.c();
            }
         } else if (var7.e() == 1) {
            ;
         }
      }

      if (var3 != -3.4028235E38F) {
         var5 += var3;
      }

      zbal var8;
      float var9;
      if (var2) {
         var7 = (zbal)var1.get(0);
         var8 = (zbal)var1.get(var1.size() - 1);
         var9 = (this.b.i() - var5) / 2.0F;
      } else {
         var9 = this.b.i() - var5;
      }

      for(int var10 = var1.size() - 1; var10 >= 0; --var10) {
         var8 = (zbal)var1.get(var10);
         var8.a.b(var8.a.g() + var9);
      }

   }

   private void d(ArrayList var1) {
      int var2 = 0;
      float var3 = Float.MAX_VALUE;

      for(int var4 = 0; var4 < var1.size(); ++var4) {
         zbal var5 = (zbal)var1.get(var4);
         if (var5.e() != 0) {
            if (var5.a.g() > var3) {
               if (var4 - 1 >= var2) {
                  this.a(var1, var2, var4 - 1);
               }

               var2 = var4;
            }

            var3 = var5.a.g();
         } else {
            if (var4 - 1 >= var2) {
               this.a(var1, var2, var4 - 1);
            }

            var2 = var4 + 1;
            var3 = var5.a.g();
         }
      }

      this.a(var1, var2, var1.size() - 1);
   }

   private void a(ArrayList var1, int var2, int var3) {
      boolean var4 = false;
      String var5 = "";

      for(int var6 = var2; var6 <= var3 && var6 < var1.size(); ++var6) {
         zbal var7 = (zbal)var1.get(var6);
         var5 = var5 + var7.a();
      }

      var4 = zar.b(var5);
      if (var4) {
         float var10 = this.b.j();

         int var11;
         for(var11 = var3; var11 >= var2 && var11 >= 0; --var11) {
            zbal var8 = (zbal)var1.get(var11);
            if (var8.e() == 2) {
               break;
            }
         }

         for(int var12 = var11; var12 >= var2 && var12 >= 0; --var12) {
            zbal var9 = (zbal)var1.get(var12);
            var9.a.a(var10);
            var10 += var9.a.h();
         }
      }

   }

   private float a(com.aspose.cells.b.a.b.zg var1) {
      return (float)((int)Math.ceil((double)this.a.a().a(var1)));
   }
}
